package com.ymk.base.cmd;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ymk.base.utlis.BigDecimalTypeAdapter;
import com.ymk.base.utlis.DateTypeAdapter;
import com.ymk.base.utlis.IntTypeAdapter;
import com.ymk.base.utlis.LongTypeAdapter;
import com.ymk.bo.user.MchDeskBO;
import org.springframework.beans.factory.annotation.Autowired;


import java.math.BigDecimal;
import java.util.Date;

public class Test {

    @Autowired
    private static ACmd aCmd;
    public static void main(String[] args) {
        Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss")
                .registerTypeAdapter(int.class, new IntTypeAdapter())
                .registerTypeAdapter(Integer.class, new IntTypeAdapter())
                .registerTypeAdapter(long.class, new LongTypeAdapter())
                .registerTypeAdapter(Long.class, new LongTypeAdapter())
                .registerTypeAdapter(Date.class, new DateTypeAdapter())
                .registerTypeAdapter(BigDecimal.class, new BigDecimalTypeAdapter())
                .create();
        String source = "{'mobile':'18539204094','password':'123456','name':'张景博','title':'张三烧烤','divideRatio':0.05}";

        CmdSign respSign = new CmdSign();
        respSign.setSource(source);
        MchDeskBO mchDeskBO = aCmd.getData(respSign,MchDeskBO.class);
        System.out.println(mchDeskBO.toString());

    }
}
